import { useState } from "react"
import ThreeReply from "./Relply/ThreeReply"
function Msg({ url, username, inf,addtimes,key }: {key:number, url: string, username: string, inf: string,addtimes:any}) {
    const [replyl, setReply] = useState<boolean>(false)
    // let add = new Date(addtimes)
    // console.log(add);
    
    function relpyc() {
        if (!replyl) {
            setReply(true)
        } else {
            setReply(false)
        }
    }
    return (
        <div className="commti" key={key}>
            <div className="atraimg" style={{ background: `url(${url})` }}></div>
            <div className="commDateList">
                <div className="nickCommt">{username}</div>
                <div className="userContex">{inf}
                    <span className="relpy" onClick={relpyc}>回复    </span>
                    <span>删除 </span>    <span>{addtimes}</span>
                </div>
                <div style={{ display: replyl ? 'block' : 'none' }}><ThreeReply /></div>
            </div>
        </div>
    )
}
export default Msg